package com.highcom.service.impl;

import com.highcom.mapper.RoleMapper;
import com.highcom.pojo.Role;
import com.highcom.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RoleServiceImpl implements RoleService {
    @Autowired
    private RoleMapper roleMapper;

    @Override
    public List<Role> findAllRoles() {
        return roleMapper.findRoles();
    }

    @Override
    public void delRoleById(int id) {
        roleMapper.delRoleById(id);
    }

    @Override
    public void delRolesByIds(int[] ids) {
        for (int id : ids) {
            roleMapper.delRoleById(id);
        }
    }

    @Override
    public Role findRoleById(int id) {
        return roleMapper.FindRoleById(id);
    }

    @Override
    public void modifyRole(Role role) {
        roleMapper.modifyRole(role);
    }

    @Override
    public void addRole(Role role) {
        roleMapper.addRole(role);
    }

    @Override
    public List<Role> findRolesLikeQuery(Role role) {
        return roleMapper.findRolesLikeQuery(role);
    }
}
